let express = require('express');
let bodyParser = require('body-parser');
let app = express();
app.use(express.static('public'));
app.use(bodyParser.urlencoded({extended:true}));
let account = '';
let psw = '';
app.get('/regist',(req,res) =>{
  let password = req.query.psw;
  let password2 = req.query.psw;
  let user = req.query.user;
  if(user != account && password == password2){
    account = user;
    psw = password;
    res.send('注册成功');
  }else{
    res.send('账号已注册')
  }
})
app.post('/login',function(req ,res){
  let name = req.body.user ;
  let password = req.body.password ;
  if(name == account && password == psw)
  {
  res.send('恭喜你登录成功')
  }else{
  res.send('登录失败，请检查账号密码')
  }
  })
  app.listen('8080',function(){
  console.log('服务器启动......')
  })